Set<Long> set = new LinkedHashSet<>(); set.iterator().next(); // LinkedHashSet guarantees insertion order
set.iterator().next();